import 'dart:io';

import 'package:json_annotation/json_annotation.dart';

class B2BLabelBean {
  String jobId; //b2b订单号
  String refId; //b2b客户单号
  String type; //lpn
  bool click; //点击展开
  List<B2BLabelDetails> list = new List();

  B2BLabelBean({this.jobId, this.refId, this.type, this.click, this.list});

  factory B2BLabelBean.fromJson(Map<String, dynamic> json) {
    return B2BLabelBean(
      jobId: json["jobId"],
      refId: json["refId"],
      type: json["type"],
      click: json["click"],
      list: json['list'] == null ? null : (new List<dynamic>.from(json['list']).map((userJson) => B2BLabelDetails.fromJson(userJson)).toList()),
    );
  }
//

}

class B2BLabelDetails {
  String sku; //sku
  int qty; //订单sku数量
  int pending; //待打单数量

  B2BLabelDetails({this.sku, this.qty, this.pending});

  factory B2BLabelDetails.fromJson(Map<String, dynamic> json) {
    return B2BLabelDetails(
      sku: json["sku"],
      qty: json["qty"] == null ? 0 : json["qty"],
      pending: json["pending"] == null ? 0 : json["pending"],
    );
  }
}

class B2BLabelLpn {
  String note;
  double length;
  double width;
  double height;
  String logisticsType;
  int lpnQty;
  int isLpn;
  int backend; //1，2为快递 3为打托

  int inventoryType; //库存类型 1正常 2退件上架 3退件自提

  B2BLabelLpn({
    this.note,
    this.length,
    this.width,
    this.height,
    this.logisticsType,
    this.lpnQty,
    this.isLpn,
    this.backend,
    this.inventoryType,
  });

  factory B2BLabelLpn.fromJson(Map<String, dynamic> json) {
    return B2BLabelLpn(
      note: json["note"],
      length: json["length"],
      width: json["width"],
      height: json["height"],
      logisticsType: json["logisticsType"],
      lpnQty: json["lpnQty"],
      isLpn: json["isLpn"],
      backend: json["backend"],
      inventoryType: json["inventoryType"],
    );
  }
}

class B2BLabelLpnQr {
  String lpn;
  String jobId;
  double length;
  double width;
  double height;

  Map<String, dynamic> toJson() {
    return {
      "lpn": this.lpn,
      "jobId": this.jobId,
      "length": this.length,
      "width": this.width,
      "height": this.height,
    };
  }
}

class B2BProcess {
  int process; //步骤 1页面1 2页面2 3页面3
  String jobId; //b2bJobId
  String lpn; //lpn
  List<B2BProcessDetails> skuQtyList = new List();
  B2BLabelSku labelInfo; //订单sku数量

  B2BProcess({
    this.process,
    this.jobId,
    this.lpn,
    this.skuQtyList,
    this.labelInfo,
  });

  factory B2BProcess.fromJson(Map<String, dynamic> json) {
    return B2BProcess(
      process: int.parse(json["process"]),
      jobId: json["jobId"],
      lpn: json["lpn"],
      skuQtyList: json['skuQtyList'] == null ? null : (new List<dynamic>.from(json['skuQtyList']).map((userJson) => B2BProcessDetails.fromJson(userJson)).toList()),
      labelInfo: B2BLabelSku.fromJson(json["labelInfo"]),
    );
  }
//

}

class B2BProcessDetails {
  String sku; //sku
  int quantity;

  B2BProcessDetails({
    this.sku,
    this.quantity,
  });

  factory B2BProcessDetails.fromJson(Map<String, dynamic> json) {
    return B2BProcessDetails(
      sku: json["sku"],
      quantity: json["quantity"],
    );
  }
}

class B2BLabelSku {
  String sku;
  String labelType; //是ZPL还是PDF
  String putAwayType; //上架方式
  int isProductLabel; //是否换标
  bool isCtnTips; //是否ctn提示
  String trackingCode; //单号
  String productLabel; //商品标
  String productLabelType; //是ZPL还是PDF
  List<String> cartonLabel; //箱标
  List<CartonLabel> cartonLabels; //箱标

  String shippingLabel; //单标
  String shippingLabelType; //是ZPL还是PDF
  String openeId; //openeId
  TipsDTO tips;
  OperateProgressDTO operateProgress;
  bool isPendingOrder; //是否有待处理订单 true 有 false 没有
  String note;
  List<B2BProcessDetails> skuQtyList = new List();

  B2BLabelSku({
    this.sku,
    this.labelType,
    this.putAwayType,
    this.isProductLabel,
    this.isCtnTips,
    this.trackingCode,
    this.productLabel,
    this.productLabelType,
    this.cartonLabel,
    this.cartonLabels,
    this.shippingLabel,
    this.shippingLabelType,
    this.openeId,
    this.tips,
    this.operateProgress,
    this.isPendingOrder,
    this.note,
    this.skuQtyList,
  });

  factory B2BLabelSku.fromJson(Map<String, dynamic> json) {
    return B2BLabelSku(
      sku: json["sku"],
      labelType: json["labelType"],
      putAwayType: json["putAwayType"],
      isProductLabel: json["isProductLabel"],
      isCtnTips: json["isCtnTips"],
      trackingCode: json["trackingCode"],
      productLabel: json["productLabel"],
      productLabelType: json["productLabelType"],
      cartonLabel: json['cartonLabel'] == null ? null : new List<String>.from(json['cartonLabel']) as List<String>,
      cartonLabels: json['cartonLabels'] == null ? null : (new List<dynamic>.from(json['cartonLabels']).map((userJson) => CartonLabel.fromJson(userJson)).toList()),
      shippingLabel: json["shippingLabel"],
      shippingLabelType: json["shippingLabelType"],
      openeId: json["openeId"],
      tips: TipsDTO.fromJson(json["tips"]),
      operateProgress: OperateProgressDTO.fromJson(json["operateProgress"]),
      isPendingOrder: json["isPendingOrder"],
      note: json["note"],
      skuQtyList: json['skuQtyList'] == null ? null : (new List<dynamic>.from(json['skuQtyList']).map((userJson) => B2BProcessDetails.fromJson(userJson)).toList()),
    );
  }
//

}

class TipsDTO {
  int productLabelQty; //商品标数
  int cartonLabelQty; //箱标数
  int shippingLabelQty; //单标数

  TipsDTO({
    this.productLabelQty,
    this.cartonLabelQty,
    this.shippingLabelQty,
  });

  factory TipsDTO.fromJson(Map<String, dynamic> json) {
    return TipsDTO(
      productLabelQty: json["productLabelQty"],
      cartonLabelQty: json["cartonLabelQty"],
      shippingLabelQty: json["shippingLabelQty"],
    );
  }
}

class OperateProgressDTO {
  int qty; //sku数量
  int picked; //拣货数量
  int pending; //待处理数量

  OperateProgressDTO({
    this.qty,
    this.picked,
    this.pending,
  });

  factory OperateProgressDTO.fromJson(Map<String, dynamic> json) {
    return OperateProgressDTO(
      qty: json["qty"],
      picked: json["picked"],
      pending: json["pending"],
    );
  }
}

class CartonLabel {
  String cartonLabel; //箱标
  String cartonLabelType; //是ZPL还是PDF

  CartonLabel({
    this.cartonLabel,
    this.cartonLabelType,
  });

  factory CartonLabel.fromJson(Map<String, dynamic> json) {
    return CartonLabel(
      cartonLabel: json["cartonLabel"],
      cartonLabelType: json["cartonLabelType"],
    );
  }
//

}
